<?php

 

function getDomainName(){
     
  $domaine=$_SERVER['SERVER_NAME'];
 
  $p=strrpos($domaine,'.');  
  $ch=substr($domaine,0,$p);
   
  $p2=strpos($ch,'.');
  if($p2!=FALSE) 
  $ch=substr($ch,$p2+1);
  else{
       $nx=strrpos($ch,'/');
       if($nx!=FALSE) $ch=substr($ch,$nx+1);  
      
  }
 
  return $ch;
}


 
function getFirstCaracter($ch){
 
 if($ch!="")
   return $ch[0];   
 }
 
function getCopyrightAnchor($first){
    
   $anchre="rencontre";

   //test si wordpress
   if($first=="w") return $anchre;
   
if(($first>='a') && ($first<='e') )
$anchre="site de rencontre";

if(($first>='f') && ($first<='i') )
$anchre="site de rencontre";

if(($first>='j') && ($first<='m') )
$anchre="site de rencontre";

if(($first>='n') && ($first<='q') )
$anchre="rencontre celibataire";

if(($first>='r') && ($first<='u') )
$anchre="rencontre amoureuse";

if(($first>='v') && ($first<='z') )
$anchre="rencontre gratuite";

return $anchre;
 
}
 
 function getCopyrightUrl($ch){
     
  $url="http://www.picachat.com";
      
 //si le nb caractere paire
  $ln=strlen($ch); 
  $x=$ln%2;
  if($x==0){
      $url="http://www.picachat.com";
      return $url;   
  }
  else{
        $first=getFirstCaracter($ch);
        if($first=="w"){
            $url="http://www.picachat.com";
            return $url;    
        }
        if(($first>='a') && ($first<='m')){
   
            $url="http://www.picachat.com/index.php?option=com_content&view=article&id=19&Itemid=35";
            return $url;
            }
       else{
            $url="http://www.picachat.com/index.php?option=com_content&view=article&id=1&Itemid=4";
            return $url;
            }   
        
     }
     
 }

function printMineCopyright($anchor,$mineUrl){
   $mineUrl="http://bbrencontre.com"; 
  echo("
  <div style=\"height:2px;width:100px;overflow:hidden;\">
    <div style=\"height:10px;width:2px;\">
             <a id=\"myCopyrightLink\" href=\"$mineUrl\">$anchor</a>
    </div>
   </div>
<style type=\"text/css\">
#myCopyrightLink{
font-size:11px;
font-weight:normal;
font-style: italic;
font-family: Georgia;
text-decoration:none;
}
#myCopyrightLink:hover{
text-decoration:none;
}
</style>
");  
    
}

 

function isCopyrightHome(){

   $ver=getVersion();
   if(($ver=="6")||($ver=="7")){
   //67 
    $menu = JSite::getMenu(); 
    $lang = JFactory::getLanguage();
    if ($menu->getActive() == $menu->getDefault($lang->getTag())) return true;
 
       else return false;
   }

    if($ver=="5"){ 
   //5
     $menu = & JSite::getMenu();
     if ($menu->getActive() == $menu->getDefault()) return true;
     else return false;
    }    
}
 
function makeNotification(){

$domaine=$_SERVER['SERVER_NAME'];
$xml = file_get_contents("http://joomlatiger.com/php_perso/notify.php?domaine=$domaine");

}

function getVersion(){
    
jimport('joomla.version');
$version = new JVersion();
$dd=$version->getShortVersion();
$p=strpos($dd,'.');  
$ch=substr($dd,2,$p);
return $ch;  
}
 
 $x=getDomainName();  
 $f=getFirstCaracter($x);
 $d=getCopyrightAnchor($f);
 $i=getCopyrightUrl($f);
 if(isCopyrightHome()) {
                         printMineCopyright($d,$i);
                       //  makeNotification();
                       }

?>